package week03.single;

/**
 * Created by zhangxiaokun on 2018/2/8.
 */
public class Singleton03 {
    private static class SingletonHolder {
        static {
            System.out.println("---SingletonHolder 被加载");
        }
        private static Singleton03 instance = new Singleton03();

        public SingletonHolder(){
            System.out.println("---SingletonHolder is create");
        }
    }

    private Singleton03() {
        System.out.println("...Singleton03 is create");
    }

    public static Singleton03 getInstance() {
        return SingletonHolder.instance;
    }

    public static void axx() {  //用于测试观察 实例是否延迟加载
        System.out.println("--Singleton02.axx() run...");
    }
}
